#include<bits/stdc++.h>
#include<cstdio>
using namespace std;
int num[1000000];
int s[1000000];
int main() 
{
//	freopen("sort.in","r",stdin);
//	freopen("sort.out","w",stdout);
    long long n,q,a,b,c,d;
    cin>>n>>q;
    for(int i=0;i<n;i++){
    	cin>>num[i];
	}
	for(int z=1;z<=q;z++){
		for(int i=0;i<n;i++){
    	    s[i]=num[i];
	    }
		cin>>a;
		if(a==1){
			cin>>b>>c;
			num[b]=c;
//			cout<<num[b];
		}
		else{
			cin>>d;
			for (int i = 1; i <= n; i++)
                for (int j = i; j>=2; j--)
                    if ( s[j] < s[j-1] ){
                        swap(s[j],s[j-1]);
                    }            
                    cout<<s[d]<<endl;
 		}
	}
    return 0;
}
//3 4
//3 2 1
//2 3
//1 3 2
//2 2
//2 3
